<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
$teacher = $this->context->CenterHeader();
$this->title = $teacher['teacher_name'];
?>
<link href="/static/css/user-center.css" rel="stylesheet">
<div class="user-banner"  style="">
<div class="container">
<div class="column-layout user-banner-in">
<div class="column-col-m">
<div class="column-layout">
    <div class="column-col-ml">
        <div class="u-photo-box"><a href="<?php echo Url::to(['teacher/teacherinfo']);?>?teacher_id=<?= Html::encode($teacher['teacher_id']) ?>"  class="u-photo" ><img src="http://files.bwphp.com/file/image/show/120/120?path=<?= Html::encode($teacher['teacher_thumb']) ?>" style="height: 98px;"></a></div>
    </div>
    <div class="column-col-m column-full">
        <!-- 老师  -->
        <div dy-v="11-11-00-00" class="u-text-info">
            <span class="u-name"><?= Html::encode($teacher['teacher_name']) ?></span><span class="text"></span><span class="u-title">职位：<?= Html::encode($teacher['position_name']) ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;来源：<?= Html::encode($teacher['from_name']) ?></span>
			<p class="u-introduction">擅长领域：<?= Html::encode($teacher['teacher_at']) ?></p>
            <p class="u-introduction">描述：<?= Html::encode($teacher['teacher_desc']) ?></p>
        </div>
    </div>
    <div class="column-col-mr">
        <div class="u-else-box">
            
            <ul class="list-inline">
                <li><a class='like' type="<?= Html::encode($teacher['teacher_id']) ?>"><span class="i-num"><?= Html::encode($teacher['like']) ?></span><span class="i-type">喜欢</span></a></li>
                
            </ul>
           
            
        </div>
    </div>
</div>
</div>
</div>
</div>
</div>
<!--不能重复喜欢弹框-->
<div class="modal fade" id="likeTwice" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-sm" style="top:150px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" style="font-size: 18px;">消息提示</h4>
            </div>
            <div class="modal-body">
                <section class="box-login v5-input-txt" id="box-login">
                        <center><h4 style="font-size: 18px;margin-bottom: 20px;">已喜欢过，不能重复喜欢</h4>
                        <button data-dismiss="modal"  style="width: 150px;" type="button" class="btn btn-micv5 btn-block">确定</button></center>
						
                </section>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
	//喜欢
	$(document).on('click','.like',function(){
		if($(this).attr("type")){
			var teacher_id = $(this).attr("type")
		}
		thiss = $(this);
		$.ajax({
			type : "get",
			url : "<?php echo Url::to(['teacher/teacherlike']);?>",
			data : 'teacher_id='+teacher_id,
			dataType : 'json',
			success: function(msg){
				if(msg.code == 1){
					//alert(msg.msg)
                    jq('#loginModal').modal('show');
				}else if(msg.code == 2){
                    //不能重复喜欢
					//alert(msg.msg)
                    jq('#likeTwice').modal('show');
				}else if(msg.code == 3){
					//喜欢成功
					thiss.replaceWith('<span class="like" type="'+teacher_id+'"><img src="<?php echo Url::to('@web/public/likes.png', true);?>" alt="" style="width: 30px;"/></span>')
					$('.like'+teacher_id).replaceWith("<font size='4px' class='like"+teacher_id+"'>喜欢： "+msg.data+" </font>")
				}else if(msg.code == 4){
					alert(msg.msg)
				}
			}
		});
	})
</script>